package shoot.FlyingObject;

import java.awt.image.BufferedImage;

/**
 * @author: dongshipan
 * @date: 2021/7/5 17:03
 * @description: 大敌机
 */
public class BigAirPlane extends BaseFlyingObject {

    private static BufferedImage[] images;

    //属性： 宽 66、高 89、x 坐标、y 坐标、速度
    /**速度*/
    private final int step = FlyConstant.BIG_AIRPLANE_STEP;

    static {
        images = new BufferedImage[5];
        images[0] = readImage("bigairplane0.png");
        for (int i = 1; i < images.length; i++) {
            images[i] = readImage("bom" + i + ".png");
        }
    }



    public BigAirPlane() {
        super(66, 89);
    }

    public BigAirPlane(int width, int height) {
        super(width, height);
    }

    public BigAirPlane(int width, int height, int x, int y) {
        super(width, height, x, y);
    }

    @Override
    public void step() {
        y += step;
    }

    /**
     * 实现 Score 中的方法
     */
    // public int getScore() {
    //     //击中大敌机得 3 分
    //     return 3;
    // }

    int index = 0;

    @Override
    public BufferedImage getImage() {
        if (isLife()) {
            return images[0];
        } else if (isDead()) {
            index++;
            if (index == images.length - 1) {
                state = FlyConstant.REMOVE;
            }
            return images[index];
        }
        return null;
    }
}
